<include file="Public/min-header" />
<style type="text/css">
    .wi80-BFB {
        width: 80%
    }

    .wi40-BFB {
        width: 40%
    }

    .seauii {

        margin-right: 10px
    }

    .he110 {
        height: 110px
    }

    .di-bl {
        display: inherit
    }
</style>
<link rel="stylesheet" href="__PUBLIC__/bootstrap/css/edit_address.css" type="text/css">

<body>
<include file="Public/breadcrumb" />
<div class="adderss-add">
    <div class="ner-reac ol_box_4" style="visibility: visible; position: fixed; z-index: 500; width: 100%; height:100%">
        <section class="content">
            <div class="container-fluid">
                <div class="panel  panel-default">
                    <div class="panel-heading">
                        <h3 class="panel-title"><i class="fa fa-list"></i> 添加自提点</h3>
                    </div>
                    <div class="box-ct">
                        <form action="{:U('Admin/Pick/add')}" method="post" onSubmit="return checkForm()">
                            <input name="pick_id" type="hidden" value="{$pick['pick_id']}" />
                            <table width="90%" border="0" cellspacing="0" cellpadding="0">
                                <tr>
                                    <td align="right"><span class="xh">*</span>自提点名称：&nbsp;</td>
                                    <td>
                                        <input class="wi80-BFB" name="pick_name" type="text" value="{$pick.pick_name}" maxlength="12" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right"><span class="xh">*</span>自提点地址：&nbsp;</td>
                                    <td>
                                        <select class="di-bl fl seauii input-sm" name="province_id" id="province" onChange="get_city(this)">
                                            <option value="0">请选择</option>
                                            <volist name="province" id="p">
                                                <option <if condition="$pick['province_id'] eq $p['id']">selected</if> value="{$p.id}">{$p.name}</option>
                                            </volist>
                                        </select>
                                        <select class="di-bl fl seauii input-sm" name="city_id" id="city" onChange="get_area(this)">
                                            <option value="0">请选择</option>
                                            <volist name="city" id="p">
                                                <option <if condition="$pick['city_id'] eq $p['id']">selected</if> value="{$p.id}">{$p.name}</option>
                                            </volist>
                                        </select>
                                        <select class="di-bl fl seauii input-sm" name="district_id" id="district">
                                            <option value="0">请选择</option>
                                            <volist name="district" id="p">
                                                <option <if condition="$pick['district_id'] eq $p['id']">selected</if> value="{$p.id}">{$p.name}</option>
                                            </volist>
                                        </select>
                                        <br>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right"><span class="xh">*</span>供货商：&nbsp;</td>
                                    <td>
                                        <select class="di-bl fl seauii input-sm" name="supplierid" id="supplier_id">
                                            <option value="0">不选则无供货商{$pickup.supplier_id}</option>
                                            <volist name="supplier" id="vo">
                                                <option <if condition="$pick['suppliers_id'] eq $vo['suppliers_id']">selected="selected"</if> value="{$vo.supplier_id}">{$vo.supplier_name}</option>
                                            </volist>
                                        </select>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right" valign="top"><span class="xh">*</span>详细地址：&nbsp;</td>
                                    <td>
                                        <textarea class="he110 wi80-BFB re-no" name="pick_address" id="address" placeholder="详细地址" maxlength="100">{$pick.pick_address}</textarea>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right">自提点联系人：&nbsp;</td>
                                    <td>
                                        <input class="wi80-BFB" type="text" name="pick_contact" placeholder="自提点联系人" value="{$pick.pick_contact}" maxlength="10" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="right"><span class="xh">*</span>自提点电话：&nbsp;</td>
                                    <td>
                                        <input class="wi40-BFB" type="text" name="pick_phone" value="{$pick.pick_phone}" onpaste="this.value=this.value.replace(/[^\d-]/g,'')" onKeyUp="this.value = this.value.replace(/[^\d-]/g, '')" maxlength="15" />
                                    </td>
                                </tr>
                                <tr>
                                    <td class="pa-50-0">&nbsp;</td>
                                    <td align="right">
                                        <button type="submit" class="btn btn-primary"><span>保存自提点</span></button>
                                    </td>
                                </tr>
                            </table>
                        </form>
                    </div>
                </div>
            </div>
        </section>
    </div>
</div>
<script src="__PUBLIC__/js/global.js"></script>
<script src="__PUBLIC__/js/pc_common.js"></script>
<script>
                                            function checkForm() {
                                                var pick_name = $('input[name="pick_name"]').val();
                                                var province_id = $('select[name="province_id"]').find('option:selected').val();
                                                var city_id = $('select[name="city_id"]').find('option:selected').val();
                                                var district_id = $('select[name="district_id"]').find('option:selected').val();
                                                var pick_address = $('textarea[name="pick_address"]').val();
                                                var pick_phone = $('input[name="pick_phone"]').val();
                                                var error = '';
                                                if (pick_name == '') {
                                                    error += '自提点名称不能为空 <br/>';
                                                }
                                                if (province_id == 0) {
                                                    error += '请选择省份 <br/>';
                                                }
                                                if (city_id == 0) {
                                                    error += '请选择城市 <br/>';
                                                }
                                                if (district_id == 0) {
                                                    error += '请选择区域 <br/>';
                                                }
                                                if (pick_address == '') {
                                                    error += '请填写地址 <br/>';
                                                }
                                                //                                            if (!checkMobile(pick_phone))
                                                //                                                error += '手机号码格式有误 <br/>';
                                                if (error) {
                                                    layer.alert(error, {
                                                        icon: 2
                                                    });
                                                    return false;
                                                }
                                                return true;
                                            }
</script>
</body>

</html>
